<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>IDoc</title>
    <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/chrome-bootstrap/1.5.0/chrome-bootstrap.min.css">
    <link href="http://apps.bdimg.com/libs/fontawesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://apps.bdimg.com/libs/bootstrap/3.3.4/js/bootstrap.js"></script>
    <!--[if lt IE 9]>
    <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <script src="${contextPath}public/js/common.js"></script>
    <script src="${contextPath}public/js/cta.min.js"></script>
</head>
<!--3cb269-->
<body style="background-color: #43cca2;margin-bottom: 60px;">

<div style="margin-top: 20px;" class="container">
    <h2 style="color: #ffffff;">Global Parameter</h2>
<div id="params">
    <% for(sharevar in sharevars){ %>
    <div class="row" style="margin-top: 8px;margin-bottom: 8px;">
        <div class="col-lg-6">
            <input type="text" class="form-control param-key" name="paramKey" placeholder="Key" value="${sharevar.key}">
        </div>
        <div class="col-lg-6">
            <div class="input-group">
                <input type="text" class="form-control param-value" name="paramValue" value="${sharevar.value}" placeholder="Value">
                          <span class="input-group-btn">
                            <button class="btn btn-default" onclick="removeThisRow(this,'${sharevar.id}')" type="button">
                                <i class="fa fa-remove"></i></button>
                          </span>
            </div>
        </div>
    </div>
    <% } %>
</div>

    <ul class="list-group">
        <li class="list-group-item list-group-item-info">
            <div class="row">
                <div class="col-lg-6">
                    <input type="text" class="form-control param-key" name="paramKey" placeholder="Key" id="key">
                </div>
                <div class="col-lg-6">
                    <input type="text" class="form-control param-value" name="paramValue" placeholder="Value" id="value">
                </div>
            </div>
            <button class="btn btn-default btn-block" id="add-params" style="margin-top: 20px;">保存参数</button>

        </li>
    </ul>

</div>
<script>
    $(function () {
        $('#add-params').click(function () {
            var key = $('#key').val();
            var value = $('#value').val();
            $.post('addParams.html',{key:key,value:value}, function (data) {
                location.reload(true);
            });
        });
    });
    function removeThisRow(event,id){
        $.post('removeParams.html',{id:id}, function (data) {
            location.reload(true);
        });
    }
</script>

</body>
</html>